package net.realsee.framework.plc;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import net.realsee.common.enums.wcs.plc.PlcReadWriteErrEnum;

/**
 * PLC操作结果
 *
 * @author 孙正华
 * @since 2023/8/10 10:11
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class PlcOperateResult {

    /**
     * 本次操作是否成功
     */
    public boolean isSuccess;

    /**
     * 本次操作内容值
     */
    public String content;

    /**
     * 具体的错误代码
     */
    public int errorCode;

    /**
     * 具体的错误描述
     */
    public String message;

    public PlcOperateResult(PlcReadWriteErrEnum errEnum) {
        this.isSuccess = false;
        this.errorCode = errEnum.getCode();
        this.message = errEnum.getMessage();
    }
}
